const { resolve } = require('path');
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
    base: './',
    resolve: {
        alias: {
            '@': resolve('src'),
            '#': resolve('types'),
        },
    },
    plugins: [react()],
    server: {
        proxy: {
            '/api': {
                target: 'localhost:8080',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, ''),
            },
        },
    },
    build: {
        target: 'es2015',
        outDir: resolve('dist/'),
        terserOptions: {
            compress: {
                keep_infinity: true,
                drop_console: true,
            },
        },
        brotliSize: false,
        chunkSizeWarningLimit: 2000,
    },
});
